﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.BL;
using SES.CMS.DO;

namespace SES.CMS.Module
{
    public partial class ucSlide : System.Web.UI.UserControl
    {
        private static DataTable dt = new DataTable();
        protected void Page_Load(object sender, EventArgs e)
        {
            loadSlide();
        }

        public void loadSlide()
        {
            dt = new SlideBL().SelectAll();
            if (dt.Rows.Count > 0)
            {
                rptSlide.DataSource = dt;
                rptSlide.DataBind();
            }
        }

        public string vTitle(string id)
        {
            string s = "";
            SlideDO obj = new SlideDO();
            obj = new SlideBL().Select(new SlideDO { SlideID = int.Parse(id) });
            if (Session["lang"] != null)
            {
                if(Session["lang"].ToString() == "VN")
                    s = obj.Title;
                else
                    s = obj.eTitle;
            }
            return s;
        }

        public string vDescription(string id)
        {
            string s = "";
            SlideDO obj = new SlideBL().Select(new SlideDO { SlideID = int.Parse(id) });
            if (Session["lang"] != null)
            {
                if(Session["lang"].ToString() == "VN")
                    s = obj.Description;
                else
                    s = obj.eDescription;
            }
            return s;
        }

        private void addHeaderOne()
        {
            HtmlHead head = Page.Header;

            LiteralControl lctl = new LiteralControl("<script type=\"text/javascript\" src=\"/js/previewOne.js\"></script>");

            head.Controls.Add(lctl);
        }

        private void addHeaderAll()
        {
            HtmlHead head = Page.Header;

            LiteralControl lctl = new LiteralControl("<script type=\"text/javascript\" src=\"/js/preview.js\"></script>");

            head.Controls.Add(lctl);
        }
    }
}